from rest_framework.response import Response


class LuffyResponse(Response):
    """luffy专用Response"""

    def __init__(self, code=2000, msg="成功", data=None, status=None, template_name=None, headers=None, content_type=None, **kwargs):
        luffy_data = {'code': code, 'msg': msg}
        if data:
            luffy_data = {'code': code, 'msg': msg, 'data': data}
        luffy_data.update(kwargs)
        super().__init__(data=luffy_data, status=status, template_name=template_name,
                         headers=headers, content_type=content_type)
